package com.boot.springbootsystem.config;

import com.boot.springbootsystem.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // registry.addInterceptor(new LoginInterceptor()) 拦截所有的方法
        // registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/user/**") 拦截/user/路径下的所有方法
        registry.addInterceptor(new LoginInterceptor());
    }
}
